<?php

/* Gets all the projects that the user is involved in.
* @header username
*/


	include_once("session.php");
	include_once("connect_to_database.php");
	
	$user = mysql_real_escape_string($_POST['username']);
	
	$query = ("SELECT `name` FROM `projects` WHERE participant = '".$user."'");
	$result = mysql_query($query);
	if(!$result)
		die(mysql_error());
	
	$array = array();
	while ($row = mysql_fetch_assoc($result)) {
		$array[] = $row['name'];
		
	}
	
	$array_data = implode(",", $array);
	echo $array_data;
	
	$_SESSION = array(); //unset session variables
	session_destroy();   //destroy session
?>